8. processing and sorting machine modular approach 5
现在,转到钻孔站中的钻孔站,我们有相当多的设备,我们有钻头驱动,我们有钻头向上或向下的运动,这与电梯非常相似,实际上几乎相同,因为我们有跟踪辐射和两个传感器,然后我们就可以激活来移动产品。
Now, moving on to the drilling station in the drilling station, we have quite a bit of devices, we have the drill actuation, we have the drill movement up or down that is quite similar to the elevator actually is almost the same because we have tracked radiation and two sensors and then we have the activation to move the product.
好的,让我们试试这个。
OK, let's try this.
让我们进入钻井站,像以前一样,我们将保留提取站作为参考。
Let's get into the drilling station and as before, we will keep the extraction station as a reference.
因此,让我们将变量从提取站复制到钻井站,即我们仍在使用的局部变量。
So let's copy the variables from the extraction station to the drilling station, the local variables that we are still using.
让我们再次构建我们的案例状态。
And let's build again our case state off.
实际上,我们可以通过删除 Sydney Bowline 的产品来复制禁用状态。
And we can actually, um, copy that disabled state by removing the products in Sydney bowline.
好吧,是的,我明白了。
OK, and, yeah, I get it.
和之前一样,我们将在这里秘密进行。
And let's right here, as before that, we will move to stealth.
好的,我们在这里得到州时间。
OK, so we get the state time and here.
好吧,如果可以的话,首先我们需要执行 Omine 程序。
Well, first we need to carry out an Omine procedure if we can.
这意味着我们需要将钻头向上移动。
This means that we need to move the drill up to.
向上到其顶部位置,所以首先我们需要这样做。
Upward to its top position, so first we will need to.
这是正确的。
That's right.
向上移动,真正向上和。
Move up, real up and.
我们还应确保其他指控在我们禁用的情况下不起作用,因此我们可以在这里写下真实的驱动应该是错误的,并且驱动也应该是错误的。
We shall also make sure that the other accusations aren't working where we are disabled, so we can write here that the real actuation should be false and the actuation as well should be false.
通过这种方式,我们确信当我们到达斯泰顿时,这两项指控都是错误的。
In this way, we are sure that also when we get to Stayton, both of those accusations are false.
因此,当我们真正向上移动以执行正在进行的过程时,我们需要通过将其设置为可购买来使用向上钻取,并通过将其设置为错误来使用向下钻取。
So when we are moving that really up to carry out an ongoing procedure and we need to use the drill up buyable by setting it through and drill down viable by setting it false.
我们将保持这种状态,直到到达钻头顶部传感器。
And we shall remain in this state until we get to the drill top sensor.
当我们到达那里时,我们需要停止练习,这样我们就可以简单地将其复制并粘贴到此处,并将这两个变量设置为 false,同时移动到另一个等于 20 的状态。
When we get there, we need to stop the drill so we can simply copy this and paste it right here and setting both of these variables to false while moving to another state state equal to 20.
好的。
OK.
现在,当我们到达这里时,我们需要等待产品。
And right now, when we get here, we need to wait for a product.
因此,我们只需等待状态 20 的产品即可。
So let's simply wait for product for state 20.
因此,在我们将产品送到这里的钻井站之前,我们什么也不做。
And so we shall do nothing until we get the product on the drilling station here.
是的,我们有一个传感器,它是钻井站上的产品,所以钻井站上的产品。
Yeah, we have a sensor that is product on drilling station, so product on drilling station.
然后我们将到达另一个状态。
Then we shall get to another state.
州30,州30。
State 30, state 30.
我们应该开始用我们的钻头向下移动,并且应该激活实际的钻头驱动问题,因为我们应该在向下移动的同时进行钻孔。
We should that should start moving down with our drill and the actual drill actuation issue should be activated because we should drill while moving down.
所以在这里我们说,开始钻取并移动,向下钻取。
So here we say, say start drill and move, drill down.
这里是 30。
And here is 30.
我们首先将钻探激活设置为通过。
We will first set the drill activation to through.
我们将开始向下钻取。
We will start moving the drill down.
因此,我们向上移动等于下降,向下钻取等于通过。
So we will have moved up equal to falls and drill down equal through.
本周我们开始钻孔,并开始向下移动钻头,我们将这样做,直到到达钻头底部传感器。
This week we started to drill and we started moving drill down and we shall do this until we get to the drill bottom sensor.
当我们到达那里时,我们应该保持练习,向下钻取的一些移动应该等于向下移动,向上移动。
When we get there, we should maintain the drill, some move drill down should become equal to falls as well, moved up.
那已经是假的了。
That was already false.
现在,让我们保持这种方式保持一致,然后转到状态 40,而不是 40。
Now, let's keep it this way to be consistent and let's move to state 40 instead 40.
我们将继续钻孔一定时间,以便在物体上产生油。
We shall keep drilling for a certain time in order to produce an oil on the object.
让我们看看我们在最初的程序中做了什么。
Let's look at what we did in our initial program.
我们在第一个程序中使用了一个计划,我们在那里等了两秒钟,所以。
We used a plan in our first program and we waited there for two seconds, so.
我们实际上可以做类似的事情,这样我们就可以复制状态。
We can actually do something similar like this so we can copy the state.
好吧,我将从头开始编写它,以防您没有从那里返回代码。
Well, I will write it from scratch in case you don't have the code back from that.
因此,假设等待裁决,我们创建一个计时器,局部变量将调用它。
So let's say wait for the ruling and let's create a timer and the local variables will call it.
我们将此称为钻孔计时器,因为我们仅将其用于此目的。
Let's call this drilling timer, since we'll be using this only for this purpose.
让我们在案例下方添加对钻取超时的调用。
And let's add a call to the drill time out here below the case.
按 F2 和。
By pressing F2 and.
文本搜索得很好,我们在这里将其称为三定时器钻孔定时器,双击,我们就可以开始了。
Text search it well, we called it a three timer drilling timer here, double click, and we are good to go.
在这里我们可以看到铁路连接计时器,NPT 应等于两秒,而钻孔计时器应被切断。
Here we can see that the rail link timer, that NPT shall be equal to two seconds and drilling timer that in should be cut through.
好的,那么我们将回到这里,如果我们在该队列中获得钻探时间,这意味着计时器已完成,我们需要首先停止钻探,因为我们完成了实际的钻探过程。
OK, then we shall go back to here and right that if we get the drilling time in that queue, meaning that the timer has finished, we will need to first stop the drill because we finished the actual drilling process.
因此,练习激活通常称为假练习。
So drill activation shall be commonly called the false.
而且,钻孔计时器应重置,而不是重置,我们称之为强制。
And also, the drilling timer shall be reset, not in, shall we call the force.
好的。
OK.
我们还将回到状态 50。
And also we shall move back to state state 50.
在状态 50 中,我们已经完成了钻探,我们将知道钻探的情况,因此我们将写下来。
Here in state 50, we have finished drilling and we shall know the drill up, so we will write up.
我们实际上可以。
We can actually.
复制这个状态,因为它非常相似。
Copy this state, because it is very similar.
您可以在这里跳过第一行。
You can skip the first line over here.
实际上,我们需要将井向上移动,一些向上将通过,或者向下钻取将是错误的,我们将这样做,直到到达顶部传感器、tweetup、传感器。
Actually, we need to move that well up, some up will be through or drill down will be false and we will do this until we reach the top senser, tweetup, senser.
好的,然后我们将转到另一个状态,即状态 16,状态 16。
OK, so and then we will move to another state that is state 16, state 16.
我们这里有一个完全钻孔的产品。
Here we have a product that is completely drilled over here.
我们的演习开始了。
Our drill is up.
因此我们将启动驱动将其向右移动。
So we shall start the actuation to move it on the right.
但只有当我们这里还没有产品时,我们才会这样做。
But we shall only do so when that when we do not have a product already of a product already here.
所以处于状态。
So in state.
60.
60.
我们实际上会的。
We will actually.
等待桌子准备好,假设,如果桌子上没有产品和三个,如果桌子上没有产品和三个,那么我们将转移到另一个等于 70 和 的状态。
Wait for a table ready, let's say, and if we do not have a product on table and three if not product on the table and three, then we shall move to another state state equal to 70 and.
这里我们有更多 70 的空气产品。
Here we have more product with air in 70.
我们会有的。
We shall have.
Er驱动等于真实。
Er actuation equals the true.
在我们将产品放在桌子上以及将产品放在桌子条目上之前,它应该保持不变。
And it should remain true until we get the product on the table and when we get the product on table entry.
我们对空气的期望应该与跌倒一样可见,而且我们实际上已经完成了我们需要做的一切。
Our air expectation should be visible equal to falls, and we have actually finished everything we need to do so.
我们其实可以回去。
We can actually get back.
两个状态20。
Two state 20.
我们身处其中。
In which we are.
纳斯林在.
Nasreen in.
是的,状态 20,因为那是我们正在等待的状态。
Yes, the state 20, because that's the state in which we are waiting for our.
国家新产品达到20个。
Our new products of state shall become equal to 20.
好的,所以我想我们已经处理了大部分事情,我认为我们不需要添加这一点,这非常重要。
OK, so I guess we managed most of the things I don't think that we need to add that is quite important.
好吧,我会不带推理地引导你,假设我们到达了状态 40。
Well, I will guide you without my reasoning, let's say that we get to state 40.
在那之前,真正的结束,我们按下了紧急按钮。
And before that, real finishes, we pressed the emergency button.
当它产生效果时,我们将到达状态零,所有指控都将是错误的,但这一次不会被重置,因为我们从未到达这部分代码。
As it came as an effect, we will get to state zero, all the accusations will be false, but this time will not be reset because we never got to this part of the code.
所以在下一次迭代中,我们将得到这个状态。
So on the next iteration, we will get this state.
钻孔时间已经结束。
And the drilling time will be already finished.
我们所有的时间都已经过去了。
We will all the time will be already elapsed.
那么我们需要做的其实就是抱歉,复制这个条件。
So do we need to do is actually sorry, copy this condition.
其中已设置的钻孔计时器等于 false。
The drilling timer that in that has been put equal to false.
我们也应该把它放在 088 上。
And we should put this also on in the 088.
这其实对你来说是件好事。
This is actually good to you.
实际上,只要我们有一个计时器并且涉及到状态机,我们就应该这样做。
We should actually do so whenever we have a timer and that is involved in the state machine.
Warith,比如说,州际之间有一些特殊的堵塞。
Warith, some, let's say, special jams between the states.
如果它是一台更精简的机器,我们总是以线性方式发生,那么您将永远不会遇到任何这些问题。
If it is a leaner machine that we always occur in a linear way, you will never have any of these issues.
但在我们的例子中,我们有一些特殊的卡纸,这些卡纸可能是由于停止按钮造成的。
But in our case, we have some special jams that can be due to stop buttons.
紧急按钮和保持按钮。
Emergency buttons and hold buttons.
因此,说到按钮、停止按钮和紧急按钮,我们实际上可以再次将指令站的代码从这里复制到这里。
So speaking of buttons, stop buttons and emergency buttons, we can actually, again copy the code from the instruction station from here to here.
我们将其复制并粘贴到此处。
Let's copy this and paste this here.
让我们删除这个,以防经常出现,也许我也可以移动这个钻探时间或在最终情况之后调用,让我们根据我们的目的修改它。
And let's remove this in case that is often there, maybe I can move also this drilling time or call after the end case and let's modify this for our purpose.
所以如果我们按下这里的紧急按钮,我们就会归零。
So if we press the emergency emergency button here, we will get to zero.
但我们也应该阻止真正的如此。
But we should also stop the real so.
实际上,我们在这里可以等于力向上移动,也可以等于力向下移动。
We can actually right here move up equal to force and move down equal to force as well.
与我们之前所做的一样,对于其他设备,当我们按下停止按钮时,我们将等待钻头到达其最终位置,无论它在哪里,朝哪个方向移动。
And in the same way as we did before, for other devices, when we press the stop, we shall wait for the drill to reach its final position, no matter where it was, in which direction it was moving.
因此,如果我们是对的,如果是真正的停止传感器或真正的底部传感器,那么就会向上钻并移动。
So if we are right, if real stop sensor or real bottom sensor, then would drill up and move.
向下钻取也应设置为等于力。
Drill down shall be put set equal to force as well.
这与我们为电梯所做的类似。
This is similar to what we did for our elevator.
也许我可以为我们打开右边的电梯站。
Maybe I can open the elevator station for us on the right.
我们做了一些非常相似的事情,装扮传感器或红色按钮传感器。
We did something very similar, dressed up sensor or red button sensor.
我们的电梯也有同样的情况。
We had the same for the elevator.
这实际上非常相似,同样,我们需要避免各州的整体要求,即向上或向下移动。
And this is actually very similar and in the same way, we need to avoid the whole and the whole the request in the states, which that is moving up or down.
而且,当钻头实际上是钻头驱动处于活动状态时,我们应避免按住,因为这样,如果我们在现实生活中停止,让我们想象一个现实生活场景,真实的将继续钻探,让我们无限期地说。
And also, we shall avoid holding when the drill is actually the drill actuation is active, because in this way, if we stop in real life, let's imagine a real life scenario that real will keep on drilling, let's say indefinitely.
我们不希望这样。
And we do not want that.
因此,当我们处于状态时,我们应该避免并处理所有请求。
So we should avoid and processing and all the requests when we are in state.
当然是 10 号州际公路、30 号州际公路、40 号州际公路。
Surely Interstate 10, Interstate 30, Interstate 40.
相反,50。
And instead, 50.
对于空气吹动的状态,我也会说同样的话,所以为了避免无限期地保持、不断给予、推动空气,我们也将这样做。
I would say the same for the states in which the air is blowing, so in order to avoid keeping, keep giving, pushing the air indefinitely, we shall do so as well.
所以我总是 10、30、40、50 和 70,这样我们就可以在这里骑。
So I always 10, 30, 40, 50 and 70 so we can ride this here.
因此,状态不等于 10,状态不等于 30,状态不等于。
So and state not equal to 10 and state not equal to 30 and state not equal.
我忘记了我写的 30、40 和 50,以及不等于 50 和不等于 70。
I forgot what I was writing 30, 40 and 50 and state not equal to 50 and state not equal to 70.
好的。
OK.
在此之后,我们应该可以开始尝试了。
After this, we should be good to go and we can try.
让我们打开我们的可视化。
Let's open our visualisations.
让我们上网下载。
And let's get online to download.
好的,让我们按开始吧。
OK, so let's press start.
并查看钻孔站是否正常工作。
And see if the drilling station works correctly.
好的。
OK.
似乎工作正常。
Seems to work fine.
它确实在向上移动,然后电工开始了。
It really is moving up and then the electrician started.
好的。
OK.
此时,电梯将停在这里,因为在该过程的激励方式中,只有当该位置没有产品时,钻孔站才能接收产品。
Right now, the elevator will stop here because in the way that this process is stimulated, the drilling station can receive the product only if there is no product in this position.
因此,直到产品从桌子上移走之前,产品和电梯都不会出去,产品中继站也不会通过。
So until the product is removed from the table, that will the product and the elevator will not go forth and the product relay station will not get through.
所以这是正确的。
So this is correct.
让我们停下来尝试一下其他巴顿。
Let's stop and try the other Bartons.
我们首先从紧急情况开始。
Let's first start with an emergency.
当钻头向下移动并且处于活动状态时。
When the drill is moving down and it is active.
好的,我们是否中途停止了,如您所见,钻探,向上钻探或向下钻探均未激活,让我们按下开始按钮,看看加温是否正常工作。
OK, did we stop the midway, as you can see, the drill, neither the drill up or drill down are active and let's press the start to see if the warming works correctly.
是的,看起来是这样,让我们再试试这件上衣。
Yes, it would seem so, let's try this top again.
让我们看看它是否停在向下的位置。
And let's see if it stops on the down position.
停止。
Stop.
它停止了,驱动实际上被移除,实际上被停用。
It stopped and actuation is actually removed, is actually deactivated.
我们重来。
Let's start again.
让我们尝试一下,我会按住按钮。
And let's try it and I'll hold button.
现在,这将在钻探结束时停止,因为所有其他对我们钻探站非法的州都将暂停,让我们清除石油,正如你所看到的,从停止的地方恢复的过程。
Now, that will stop at the end of the drilling, because all the other states who are illegal for our drilling station are to hold, let's remove the oil, as you can see, the process that resumes from where it was stopped.
好的,这太棒了,我们也成功地实现了钻井站。
OK, so this was great that we managed to implement the drilling station as well.
只剩下桌子了,之后,我们的整台机器将以模块化方式工作,不同的流程并行。
Only the table remains, and after that, we will have our full machine working in a modular way with different processes in parallel.